The code in this replication package constructs the results in the tables and figures for the paper: “Price Selection in the Microdata” by Peter Karadi, Raphael Schoenle and Jesse Wursten.

The codes run in Stata and Matlab, all .do and .m files are provided. 

The proprietary IRi data are available from marketing firm IRi. 

The data on monetary shocks and US aggregate variables as in the paper is provided in the files Karadi2017.dta, Karadi2019_ECB.dta and  US_variables.dta.

The confidential producer price (PPI) micro data can be accessed by applying to Bureau of Labor Statistics (BLS) Restricted Data Access. The procedure is outlined on the BLS website, currently at https://www.bls.gov/mxp/about/visiting-researchers.htm. Obtaining access takes 9-12 months and requires meeting the BLS criteria. 

---
Stata part

To run the Stata part, adapt the rootL (for Large) and rootD (for Dofiles) globals in each dofile. The scripts assume that you have saved the IRi data in $rootL/Data/Raw (one folder per year) and saved the later released "masked_chain_xref1_12.csv" and "milk_drug_1427_1478" files in $rootL/Data/Raw/Extra. You can adapt most of these assumptions in 999_Paths.do

We recommend running the Stata dofiles in order, i.e.
- a0_ImportData to import the raw data and generate reset and competitor prices
- a1_PrepData to prepare the data for later regressions
- a2_RegressionDispersion to run the micro regressions
- a3_SideAnalyses to generate extra exhibits, such as the price dispersion graphs

Each of these dofiles has options near the top to specify which tasks you want executed. Be warned that some of them require a computer with 128GB of ram, even with the _10pct sample we use for the regressions. The data preparation step also includes code that can be used to run the code in parallel, this requires the batcher program from SSC (developed for this project in fact).

In order to link the Tables and Figures in the paper to the code, simply search for the relevant identifier (e.g. Table 5). In general, the import data and prepare data steps need to be ran before any exhibit can be reproduced.

Please do not hesitate to reach out to any of the listed authors if you need assistance.

